<head>
	<?php
	require_once("admin/m/chat/chatjs_class.php");
	?>
	<script src="http://connect.facebook.net/en_US/all.js"></script>
</head>
<body id='popout-body' scroll="no"><section id='popout' class='body'>
	
	<section id='popout-selector'>
		<img src="assets/images/pt-player-main-header.png" width="310" height="39" alt="Pt Player Main Header">
		
		
		<div id='popout-social'>
		
						
									<?PHP

									if($conf->facebook)
									{
										?>
											     <!-- AddThis Button BEGIN -->
												<div class="addthis_toolbox addthis_default_style ">
												<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
												<a class="addthis_button_tweet"></a>

												</div>
												<script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
												<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4dc99e7b35c96e4c"></script>
												<!-- AddThis Button END -->

										<?PHP
									}
									?>
									
						               
	
		</div>

		<div id='popout-communities'>
		
			
					<?PHP 
					foreach($header_dropdown as $z)
					{
						
										foreach($z['child'] as $y)
										{
											if($y['status']='enabled')
											{
												?>
												<li class='popout-category' name='co<?PHP echo $y["id"];?>' title='Content from <?PHP echo $y["name"];?>'><?PHP echo $y["name"];?></li>
													<div class='popout-content' id='pcco<?PHP echo $y["id"];?>'>
													
													</div>
												
												<?PHP
												
												
											}
											
										}
										
										

					}
					?>
					
		</div>
		
		
	
	</section>
	<script src="assets/js/jpopup.js" type="text/javascript" charset="utf-8"></script>
	
	<script type="text/javascript">
	
		$('.popout-selector-back').click(function () {
		
			$(".popout-content").slideOut(150);
			$(".popout-selector-back").slideOut(150);

  	    });
       

	  	$('.popout-category').click(function () {
	        var cid = $(this).attr("name");
	
	     	var community=cid.replace("co", "");
			$.ajax({ type: 'POST', url: "a/popout-community.php", data: "id="+community, context: document.body, success: function(data){
		    	$(".popout-content").fadeOut(150);
				$(".popout-selector-back").fadeOut(150);

				//alert("#pc"+cid);
				$("#pc"+cid).html(data);

				$("#pc"+cid).fadeIn(150);
				$("#pb"+cid).fadeIn(150);
		
		      }});
	    });
	
	
	
			$(document).ready(function(){
				$("#pcco<?PHP echo $content['category'];?>").show();
				var community=<?PHP echo $content['category'];?>;
				$.ajax({ type: 'POST', url: "a/popout-community.php", data: "id="+community, context: document.body, success: function(data){
			  
					$("#pcco<?PHP echo $content['category'];?>").html(data);
					$("#pcco<?PHP echo $content['category'];?>").fadeIn(150);
			

			      }});
			});
	
	// iniztialize player
	
	
	
	
	   var flashvars = {
		'manifest': '<?PHP echo $conf->absolute_path;?>manifest.f4m',
			  'absolutePath': '<?PHP echo $conf->absolute_path;?>',
			  'user_email': '<?PHP echo $_SESSION["user_email"];?>'
	   };

	   var params = {
	      'allowfullscreen':   'true',
	      'allowscriptaccess': 'always',
	      'bgcolor': '#3A3A3C'
	   };

	   var attributes = {
	      'id': 'mediaplayer',
	      'name': 'mediaplayer'
	   };

	   swfobject.embedSWF( '<?PHP echo $conf->absolute_path;?>assets/player/<?PHP echo $content["flashplayer"];?>/player.swf?<?PHP echo randomchar();?>', 'player', '620', '400', '10.1', 'false', flashvars, params, attributes);
	
	</script>
		<section id='popout-player'>
			<?PHP if(!$conf->chatmode)
			{ 
				
				?>
		
		
				<div id='player'>
			
   	
				Javascript and Flash is Required to View this Video.
	
		
			</div>
			<?PHP 
			} else { $chat_id='-chat';} ?>
	<div id='popout-discovery<?PHP echo $chat_id;?>'>
		<script type="text/javascript">
          var chat =  new Chat();//create new chat instance--------------------------
	      chat.setIntval();
	   	  
	 $(function(){
	   $("#nick").focus(function()
	   {
	    chat.clearIntval();
		$("#send").attr("disabled",true);
	   }
	   );
	   $("#nick").blur(function()
	   {
	   $("#send").attr("disabled",false);
	    chat.update();
	    chat.setIntval();
	   }
	   );
	      
	 	  // strip tags
	     name = name.replace(/(<([^>]+)>)/ig,"");
		 
		$("#view-history-button").click(
		 	function(){
		 	  if(!($(this).hasClass("active-tab")))
				{
					$("#tab-selectors").children().removeClass("active-tab");
					$(this).addClass("active-tab");
						$("#messageWrap").fadeOut(250);
						$("#messageWrap").empty();  
					  	$("#messageWrap-chat").delay(500).fadeIn(250);
					chat.clearIntval();
					chat.showHistory();
					$("#send-box").css("display","none");
					$("#messageWrap-chat").fadeOut(250);
						$("#messageWrap").delay(500).fadeIn(250);
				}
				
				
		});
		$("#info-button").click(
		 	function(){
		 	  if(!($(this).hasClass("active-tab")))
				{
					$("#tab-selectors").children().removeClass("active-tab");
					$(this).addClass("active-tab");
					$("#messageWrap").fadeOut(250);
					$("#messageWrap").empty();  
				  	$("#messageWrap-chat").delay(500).fadeIn(250);
					chat.clearIntval();
					$("#messageWrap").append(
					"<?PHP 
					 echo "<li><h3>".$content['title']."</h3></li>";
					 echo "<li><h5>".$content['content']."</h5></li>";
					
					
					?>"
					);
					$("#messageWrap-chat").fadeOut(250);
						$("#messageWrap").delay(500).fadeIn(250);
					$("#send-box").css("display","none");
				}
				
				
		});
			
		$("#chat-button").click(function()
		{
			if(!($(this).hasClass("active-tab")))
			{
			
				$("#tab-selectors").children().removeClass("active-tab");
				$(this).addClass("active-tab");
				$("#messageWrap").fadeOut(250);
				$("#messageWrap").empty();  
			  	$("#messageWrap-chat").delay(500).fadeIn(250);
				chat.back_to_chat();
				$("#send-box").css("display","inline");
				
				$("#messageWrap-chat").fadeOut(250);
					$("#messageWrap").delay(500).fadeIn(250);
				setTimeout(chat.setIntval(),1000);
			}	
			
		});
	
		
		//send handler
	    $("#send").click(function() {
			   var msg = $('#message').attr('value');
                chat.send(name,msg);
                $(this).val("");  
            
	    });
	
	    $('#message').keyup(function(event) {
	    	
	    var shift = event.shiftKey;
	    if (!shift && event.keyCode == '13') {
	   		var msg = $('#message').attr('value');
	     	var maxLength = $(this).attr("maxlength");
          	var length = msg.length; 
          
	   		if (length <= maxLength + 1) {
                chat.send(name,msg);
                $(this).val("");
              } else {
                $(this).val(msg.substring(0, maxLength));
              }
   		}
		      
		
		});
   	    
   		$(window).bind("beforeunload", function() { 
        	chat.disconnect();
		});
		$(window).blur(function(){
		 chat.clearIntval();
		});
		$(window).focus(function(){
				$("#messageWrap").empty();  
				chat.back_to_chat();
				setTimeout(chat.setIntval(),1000);
		});
		
   
   });
    </script>

		   <?php 
			 include("assets/pages/chatpage.php");
			?>	
				
			

	</div>
	</section>
     	
	
	
	
	

</section></body>